<?php
/**
 * Created by PhpStorm.
 * User: yellow
 * Date: 2019/5/18
 * Time: 18:20
 */

namespace app\common\model;

use think\Model;

class BusBusiness extends Model
{
    protected $insert = ['status' => 3];
    private $statusArr = [0=>'未审核', 1=>'已审核', 2=>'已冻结', 3=>'审核中'];

    protected static function init(){
        //TODO:初始化内容
    }

    public function info(){
        return $this->hasOne('BusBusinessInfo', 'business_id', 'id')->bind([
            'licence_no',
            'business_licence',
            'id_card_no',
            'bus_num',
            'id_card_front',
            'id_card_back'
        ]);
    }

    /**
     * 获取状态
     * @param $statusArr
     */
    public function getStatusAttr($value){
        return $this->statusArr[$value];
    }

    public function getCreateTimeAttr($value){
        return date('Y-m-d H:i', $value);
    }

}